package com.example.backend.services;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class Functions {
    @Autowired
    BookService bookService;
    @Tool(description = "当用户提出要还书时调用此方法进行还书，如果用户没有提供借阅编号则提醒用户提供借阅编号")
    public String returnBook(@ToolParam(description = "借阅编号") String bid){

        System.out.println("调用还书方法");
        System.out.println(bid);
        bookService.returnBook(bid);
        return "归还成功";
        };
    @Tool(description = "当用户提出要借书时调用此方法进行借书，如果用户没有提供用户编号和图书编号则提醒用户提供图书编号")
    public String borrowBook(@ToolParam(description = "用户编号")String uid,@ToolParam(description = "图书编号") String bid){

        System.out.println("调用借书方法");
        System.out.println(bid);
        bookService.borrowBook(uid,bid);
        return "借书成功";
    };
}
